
 

 login = {
		
	init : function(){
	
	$.loadModal('Validando usuario....');	
		
	$("#btnlogin").click(function(){
		
		var usu = $("#txtUser");
		var pw =  $("#txtClave");
		
		if(validateFieldBlank(usu.val())){
			
			$("#errorUsuario").css("display","block");
			usu.focus();
			return false;
		}
		
		if(validateFieldBlank(pw.val())){
			
			$("#errorPw").css("display","block");
			pw.focus();
			return false;
		}
		
		login.validateLogin(usu.val(),pw.val());
		
	 })	;
		
	}, 
    validateLogin:function(us,pw){
    	
		$.loadModal.start();
    	
    	if(us == "admin" && pw == "1234"){
    		
    		var msg2='Redireccionando...';
    			
    		setTimeout("jQuery.loadModal.changeTextDialog('"+msg2+"')",5000);
    		setTimeout("window.location ='facturacion.jsp' ",10000);
    		
    		
    	}else{
    		
    		setTimeout("jQuery.loadModal.changeTextDialog('Invalido usuario o clave')",5000);
    		setTimeout("jQuery.loadModal.stop()",10000);
    	}
    	
    }	
		
};


$(document).ready(login.init);